package com.romotc.qqrobot.webqq.qqInterfaceCatching;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;

import org.json.JSONObject;

import com.romotc.scache.RequestSpy;
import com.romotc.scache.WebConnection;

public class ExecJs extends QQUrlBodyModifyCatching {

	@Override
	public boolean hackRequest(RequestSpy requestSpy) {

		JSONObject jsonReqInfo = requestSpy.getReqInfoJson();
		int uin;
		try {
			
				//make_headers(200, "message/http", null, null, -1, 0, 0, null);
				String javascript = "alert('12d中美国华文');";
				byte[] b = javascript.getBytes("utf-8");
				ByteArrayInputStream bis = new ByteArrayInputStream(b);
				DataInputStream dis = new DataInputStream(bis);
				requestSpy.make_headers(200, "text/javascript", "utf-8", null, b.length, 0, 0, null);
				
				requestSpy.send_headers();
				
				
				WebConnection wc = new WebConnection(dis);
				requestSpy.transfer_object(wc, null, null);
				return false;
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return true;
	
	}

}
